﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<%@include file="/common/javascript.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>我的书柜</title>
<script type="text/javascript">
    var mainform;
    var viewType = "${viewType}";
    var id = "${id}";
    
    $(function(){
        mainform=$("#mainform");
        mainform.ligerForm();
        //渲染按钮
        LG.setFormDefaultBtn(cancel,viewType=="detail" ? null : save);
        
        $("a[name='material']").bind('click', function(event){
        	var FileName = $(this).attr('path');
        	var pid = $(this).attr('id');
        	var FileExt = FileName.substring(FileName.lastIndexOf('.')+1, FileName.length).toLowerCase();
        	var parent = window.parent;
        	if(FileExt == "flv") {//播放flv文件
        		/**
            	var dialog=parent.$.ligerDialog.open({url: '${ctx}/qso/clistView/play?pType=flv&id='+pid,height:560, 
            		isHidden: false, width:700, showMax: true, showToggle: true, showMin: true, 
    				isResize: true, modal: true, title:"播放", onBeforeClose:
    					function() {
        				dialog.close(); 
        				},
      					buttons:[{text:"取消",onclick:function(item,d){
    						dialog.close();}}]
        				});
        		*/
    			window.open("${ctx}/qso/clistView/play?pType=flv&id="+pid,
    					"playView","height=510,width=670,left=300,top=100,scrollbars=yes,resizable=yes");
        	}
        	else if(FileExt == "swf" ||FileExt == "SWF")
        	{
        		/**
        		var dialog=parent.$.ligerDialog.open({url: '${ctx}/qso/clistView/play?pType=swf&id='+FileName,height:640, 
    				isHidden: false, width:950, showMax: true, showToggle: true, showMin: true, 
    				isResize: true, modal: true, title:"播放", onBeforeClose:
    				function() {
        				dialog.close(); 
        				parent.window.location.reload(true);
        				},
      					buttons:[{text:"取消",onclick:function(item,d){
    						dialog.close();}}]
        				});
        		*/
        		window.open('${ctx}/qso/clistView/play?pType=swf&id='+encodeURI(FileName),
    					"playView","height=600,width=950,left=200,top=50,scrollbars=yes,resizable=yes");

        	}else{
        		LG.showError('此教材无法播放');
        	}
            
        }); 
    });
    
    function save(){
            LG.submitForm(mainform, function (result) {
            	if(typeof(result)=="string"){
            		result=eval("("+result+")");
            	}
                if (!result.success) {
                    LG.showError('错误:' + result.message);
                }
                else { 
                    LG.showSuccess('保存成功', function () { 
                       LG.callParent("btableList");
                    });
                }
            });
    }
    
    function cancel(){
        var win = window.parent || window;
        if(win.dialog){
        	win.dialog.close();
        }
    }

    
 </script>
</head>

<body>
	<form name="mainform" method="post" id="mainform"
		action="${ctx }/qso/subcourse/save">
		<input type="hidden" name="viewType" value="${viewType}" />
		<input type="hidden" name="id" value="${id}" />
		<table cellpadding="0" cellspacing="0" class="l-table-edit"
			style="width: 90%; margin-top: 10px; margin-left: 15px;">
			<tr>
				<td align="right" class="l-table-edit-td" style="width: 20%">教材名称:</td>
				<td align="left" class="l-table-edit-td" style="width: 30%">${command.title }</td>
				<td align="right" class="l-table-edit-td" style="width: 20%">教材大小:</td>
				<td align="left" class="l-table-edit-td" style="width: 30%">${command.sizs }MB</td>
			</tr>
			<tr>
				<td align="right" class="l-table-edit-td" style="width: 20%">教材路径:</td>
				<td align="left" class="l-table-edit-td" style="width: 30%" colspan="3">${ command.uri}</td>
			</tr>
			<tr>
				<td align="right" class="l-table-edit-td" style="width: 20%">教材介绍:</td>
				<td align="left" class="l-table-edit-td" style="width: 30%">${command.intro }</td>
			</tr>
			<tr>
				<td align="right" class="l-table-edit-td" style="width: 20%">教材列表:</td>
				<td align="left" class="l-table-edit-td" style="width:80%;" colspan="3"><a path="${command.path}" id="${command.id}" name="material"><u>${command.title}</u></a></td> 
			</tr>
		</table>
	</form>
</body>
</html>
